Tween Module
Version 1.5 (See CHANGES.TXT for version details)
Created by Edmundo Ruiz (edmundo@edmundito.com)
Additional scripting by Tzach Shabtay
This module can be used to create programatic inbetweens (tweens) for AGS objects. It allows these effects to be blocking, non blocking, or loop them, and it has acceleration/deceleration timing functions.
Note that the script syntax differs a bit between AGS 3.x and AGS 2.x, which will be noted in this documentation. You can also make the AGS 2.x syntax also available in AGS 3.x; check out the Settings section for more info.
License
This module is distributed under the very liberal MIT License.
That said, you are welcome but not obliged to give us credit in your game as:
Special Thanks
Edmundo Ruiz
Tzach Shabtay
OR if you prefer something along these lines:
Tween Module by Edmundo Ruiz and Tzach Shabtay
And in the AGS Games database:
netmonkey Tween Module
tzachs Tween Module
Settings
At the top of the script module header, there are a few constants that affect how the Tween module works:
#define MAX_TWEENS 16 #define DEFAULT_TweenTiming eLinearTween #define DEFAULT_GUI_TweenTiming eLinearTween #define DEFAULT_Audio_TweenTiming eLinearTween #define DEFAULT_TweenStyle eBlockTween #define DEFAULT_GUI_TweenStyle eBlockTween #define DEFAULT_Audio_TweenStyle eNoBlockTween #define DEFAULT_TweenStopResult ePauseTween #ifdef AGS_SUPPORTS_IFVER #ifver 3.0 #define AGS_2_COMPATIBLE_TWEENS_DISABLED #define TWEEN_1_2_LEGACY_FUNCTIONS_DISABLED #endif #endif
These #defines allow you to change some of the defaults very easily!
- MAX_TWEENS is the number of simultaneous tweens that can be played in the game. Note that increasing this number may slow down your game, so make sure you do it if you really need to.
- DEFAULT_TweenTiming changes the default value for the optional TweenTiming in all the Tween functions, except for GUI-Related tweens.
- DEFAULT_GUI_TweenTiming changes the default value for the optional TweenTiming in all the GUI-related Tween functions.
- DEFAULT_Audio_TweenTiming changes the default value for the optional TweenTiming in all the Audio-related Tween functions.
- DEFAULT_TweenStyle changes the default value for the optional TweenStyle in all the Tween functions, except for GUI-Related tweens.
- DEFAULT_GUI_TweenStyle changes the default value for the optional TweenStyle in all the GUI-related Tween functions.
- DEFAULT_Audio_TweenStyle changes the default value for the optional TweenStyle in all the Audio-related Tween functions.
- DEFAULT_TweenStopResult changes the default value for the optional TweenStopResult in all the Tween stop functions.
- AGS_2_COMPATIBLE_TWEENS_DISABLED Only available in AGS 3.0 and above, it turns off the 2.0 based Tween function syntax. If you're migrating Tween code from a game created in AGS 2, you can comment this line out and tweens will work again!
- TWEEN_1_2_LEGACY_FUNCTIONS_DISABLED This disables pre-1.5 Tween functions for AGS 2 that were made redundant with changes in Tween 1.5. If you are updating the module and use some of these functions (all of them related to GUI controls), then you can comment this line and they will be available again.
GUI-related objects have been specifically chosen to have their own TweenTiming and TweenStyle setting because very often GUIs can have a more consistent and graceful transition animations as well as from a interface design standpoint it's much nicer to move the user interface around without blocking the user. This, however, would require more clever scripting and it may be a bit more advanced for beginning AGS scripters.
Audio-related tweens have their own TweenTiming and TweenStyle by default they should behave a little different from all visual objects when tweening. It's a lot nicer if audio-related tweens don't block the game, for example.
Enumerated types
TweenTiming
enum TweenTiming { eLinearTween, eEaseInTween, eEaseOutTween, eEaseInEaseOutTween };
Used to set the timing of the tween, whether it's just a linear interpolation, one that only accelerates when it starts, one that only decelerates when it ends, or both accelerates at start and decelerates at end.
TweenStyle
enum TweenStyle { eBlockTween, eNoBlockTween, eRepeatTween, eReverseRepeatTween, };
Used to set the style of the tween, whether is blocking, non-blocking, repeating, or repeating reverse (where at the end of the tween cycle and repeats, it reverses the direction of the tween).
TweenStopResult
enum TweenStopResult { ePauseTween, eFinishTween, eResetTween, };
Used to set how a tween should stop when any of the stop functions is called, whether it should stay where it is (pause), complete the tween immediately (finish), or go back to where it started (reset).
Functions
GetDistance (new)
// AGS 2.x and 3.x GetDistance(int fromX, int fromY, int toX, int toY);
Returns the distance between two points as an integet.
Example:
int distanceBetweenEgoAndBluecup = GetDistance(cEgo.X, cEgo.Y, oBluecup.X, oBluecup.Y);
Will return the distance between the Ego character and the Bluecup object.
SecondsToLoops
// AGS 2.x and 3.x SecondsToLoops(float seconds);
Converts and returns the number of seconds into game loops.
Example:
Wait(SecondsToLoops(5.0));
Will wait for 5 seconds. However, see WaitSeconds below for an easier way.
WaitSeconds
// AGS 2.x and 3.x WaitSeconds(float seconds);
Waits for a number of seconds, as opposed to AGS's Wait which uses loops.
Example:
WaitSeconds(5.0);
Will wait for 5 seconds.
WaitForTweensToStop (new)
// AGS 2.x and 3.x WaitForTweensToStop();
Waits for all currently playing non-repeat Tweens to stop.
Example:
cEgo.TweenPosition(5.0, 320, 240, eLinearTween, eNoBlockTween); oBluecup.TweenTransparency(2.0, 100, eLinearTween, eNoBlockTween); gStatusBar.TweenSize(1.0, 100, 100, eLinearTween, eNoBlockTween); WaitForTweensToStop();
Will wait until cEgo stops tweening because it has the longest lasting tween.
StopAllTweens
// AGS 3.x Character.StopAllTweens(optional TweenStopResult) GUI.StopAllTweens(optional TweenStopResult) Object.StopAllTweens(optional TweenStopResult) Label.StopAllTweens(optional TweenStopResult) Button.StopAllTweens(optional TweenStopResult) TextBox.StopAllTweens(optional TweenStopResult) ListBox.StopAllTweens(optional TweenStopResult) Slider.StopAllTweens(optional TweenStopResult) InvWindow.StopAllTweens(optional TweenStopResult) // AGS 3.2+ (STRICT_AUDIO only) AudioChannel.StopAllTweens(optional TweenStopResult) // AGS 2.x TweenStopAllForCharacter(Character* character, optional TweenStopResult) TweenStopAllForGUI(GUI* gui, optional TweenStopResult) TweenStopAllForObject(Object* object, optional TweenStopResult) TweenStopAllForLabel(Label* label, optional TweenStopResult) TweenStopAllForButton(Button* button, optional TweenStopResult) TweenStopAllForTextBox(TextBox* textBox, optional TweenStopResult) TweenStopAllForListBox(ListBox* listBox, optional TweenStopResult) TweenStopAllForSlider(Slider* slider, optional TweenStopResult) TweenStopAllForInvWindow(InvWindow* invWindow, optional TweenStopResult)
Stops all the Tweens currently playing on the a character, GUI, room object, etc.
Example:
// AGS 3.x cEgo.StopAllTweens(); gIconbar.StopAllTweens(); oBluecup.StopAllTweens(); // AGS 2.x TweenStopAllForCharacter(cEgo); TweenStopAllForGUI(gIconbar); TweenStopAllForObject(oBluecup);
Will stop all the tweens for cEgo, cIconbar, and oBluecup.
See Also: TweenStopAll
TweenPosition
// AGS 3.x Character.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) GUI.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) Object.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) Label.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) Button.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TextBox.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) ListBox.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) Slider.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) InvWindow.TweenPosition(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) // AGS 2.x TweenCharacterPosition(Character* character, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenGUIPosition(GUI* gui, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenObjectPosition(Object* object, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenLabelPosition(Label* label, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenButtonPosition(Button* button, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenTextBoxPosition(TextBox* textBox, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenListBoxPosition(ListBox* listBox, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenSliderPosition(Slider* slider, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenInvWindowPosition(InvWindow* invWindow, float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle)
Tweens the position of a character, GUI, object, etc. from its current position to another. Note that by default, GUI tweens are non-blocking unlike the character and object tweens.
Returns the tween duration (in loops) if the TweenStyle is non-blocking (eNoBlockTween). For a repeat TweenStyle (eRepeatTween or eRepeatReverseTween) it returns the duration of one tween cycle. For blocking tweens, it returns a 1.
Example:
// AGS 3.x cEgo.TweenPosition(2.5, 100, 100); // AGS 2.x TweenCharacterPosition(cEgo, 2.5, 100, 100);
Will tween the position of the character from its current position to x 100, y 100 in 2.5 seconds.
TweenPositionBySpeed (new)
// AGS 3.x Character.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) GUI.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) Object.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) Label.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) Button.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TextBox.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) ListBox.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) Slider.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) InvWindow.TweenPositionBySpeed(float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) // AGS 2.x TweenCharacterPositionBySpeed(Character* character, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenGUIPositionBySpeed(GUI* gui, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenObjectPositionBySpeed(Object* object, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenLabelPositionBySpeed(Label* label, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenButtonPositionBySpeed(Button* button, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenTextBoxPositionBySpeed(TextBox* textBox, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenListBoxPositionBySpeed(ListBox* listBox, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenSliderPositionBySpeed(Slider* slider, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle) TweenInvWindowPositionBySpeed(InvWindow* invWindow, float speed, short toX, short toY, optional TweenTiming, optional TweenStyle)
Tweens the position of a character, GUI, object, etc. from its current position to another based on the givens speed. The duration is calculated based on the distance between the start position and the end position of the object.
Same as TweenPosition, it returns the tween duration (in loops) if the TweenStyle is non-blocking (eNoBlockTween). For a repeat TweenStyle (eRepeatTween or eRepeatReverseTween) it returns the duration of one tween cycle. For blocking tweens, it returns a 1.
Example:
// AGS 3.x cEgo.TweenPositionBySpeed(2.5, 100, 100); // AGS 2.x TweenCharacterPositionBySpeed(cEgo, 2.5, 100, 100);
Will tween the position of the character from its current position to x 100, y 100 by 2.5 pixels per second.
TweenScaling
// AGS 3.x Character.TweenScaling(float seconds, short toScale, optional TweenTiming, optional TweenStyle) // AGS 2.x TweenCharacterScaling(Character* character, float seconds, short toScale, optional TweenTiming, optional TweenStyle)
Tweens the scaling of a character.
Returns the tween duration (in loops) if the TweenStyle is non-blocking (eNoBlockTween). For a repeat TweenStyle (eRepeatTween or eRepeatReverseTween) it returns the duration of one tween cycle. For blocking tweens, it returns a 1.
Example:
// AGS 3.x cEgo.TweenScaling(1.5, 200); // AGS 2.x TweenCharacterScaling(cEgo, 1.5, 200);
Will tween the scaling of Ego from its current scale to 200% in 1.5 seconds.
TweenSize
// AGS 3.x GUI.TweenSize(float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) Label.TweenSize(float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) Button.TweenSize(float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) TextBox.TweenSize(float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) ListBox.TweenSize(float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) Slider.TweenSize(float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) InvWindow.TweenSize(float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) // AGS 2.x TweenGUISize(GUI* gui, float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) TweenLabelSize(Label* label, float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) TweenButtonSize(Button* button, float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) TweenTextBoxSize(TextBox* textBox, float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) TweenListBoxSize(ListBox* listBox, float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) TweenSliderSize(Slider* slider, float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle) TweenInvWindowSize(InvWindow* invWindow, float seconds, short toWidth, short toHeight, optional TweenTiming, optional TweenStyle)
Tweens the size of a GUI, Label, Button etc.
Returns the tween duration (in loops) if the TweenStyle is non-blocking (eNoBlockTween). For a repeat TweenStyle (eRepeatTween or eRepeatReverseTween) it returns the duration of one tween cycle. For blocking tweens, it returns a 1.
Example:
// AGS 3.x gStatusline.TweenSize(1.0, 50, 50); // AGS 2.x TweenGUISize(gStatusline, 1.0, 50, 50);
Will tween the size the statusline GUI from its current size to 50x50 pixels in 1 second.
TweenStopAll
// AGS 2.x and 3.x TweenStopAll(optional TweenStopResult)
Stops every single tween currently playing.
Example:
TweenStopAll();
Will stop whatever tweens where currently playing, whether it was a GUI, character, or room object tween.
TweenTransparency
// AGS 3.x Character.TweenTransparency(float seconds, short toTransparency, optional TweenTiming, optional TweenStyle) GUI.TweenTransparency(float seconds, short toTransparency, optional TweenTiming, optional TweenStyle) Object.TweenTransparency(float seconds, short toTransparency, optional TweenTiming, optional TweenStyle) // AGS 2.x TweenCharacterTransparency(Character* character, float seconds, short toTransparency, optional TweenTiming, optional TweenStyle) TweenGUITransparency(GUI* gui, float seconds, short toTransparency, optional TweenTiming, optional TweenStyle) TweenObjectTransparency(Object* object, float seconds, short toTransparency, optional TweenTiming, optional TweenStyle)
Tweens the transparency of a character, GUI, or object from its current transparecy to another. Note that by default, GUI tweens are non-blocking unlike the character and object tweens.
Returns the tween duration (in loops) if the TweenStyle is non-blocking (eNoBlockTween). For a repeat TweenStyle (eRepeatTween or eRepeatReverseTween) it returns the duration of one tween cycle. For blocking tweens, it returns a 1.
Example:
// AGS 3.x oBluecup.TweenTransparency(3.0, 100); // AGS 2.x TweenObjectTransparency(oBluecup, 3.0, 100);
Will tween the transparency of the room object Bluecup to from its current value to 100% (thus fading it out).
TweenViewportX
// AGS 2.x and 3.x TweenViewportX(float seconds, short toX, optional TweenTiming, optional TweenStyle);
Tweens the location of the viewport on the x axis from its current location to another.
Example:
TweenViewportX(3.0, 100);
Will tween the location of the viewport on the x axis from its current location to 100.
TweenViewportY
// AGS 2.x and 3.x TweenViewportY(float seconds, short toY, optional TweenTiming, optional TweenStyle);
Tweens the location of the viewport on the y axis from its current location to another.
Example:
TweenViewportY(3.0, 100);
Will tween the location of the viewport on the y axis from its current location to 100.
TweenViewportXY
// AGS 2.x and 3.x TweenViewportX(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle);
Tweens the location of the viewport on the x axis and on the y axis from its current location to another.
Example:
TweenViewportX(3.0, 100, 20);
Will tween the location of the viewport on the x axis from its current location to 100, and on the y axis from the current locatio to 20.
TweenGamma
// AGS 2.x and 3.x TweenGamma(float seconds, short toGamma, optional TweenTiming, optional TweenStyle);
Tweens the screen gamma level from its current value to another. Note that System.SupportGammaControl must return true in order for this method to have any effect. Range: 0 (black) - 200 (bright)
Example:
if (System.SupportsGammaControl) { TweenGamma(3.0, 150); }
Will tween the screen gamma from its current value to 150 (which is 50% brighter than default).
TweenShakeScreen
// AGS 2.x and 3.x TweenShakeScreen(float seconds, short fromDelay, short toDelay, short fromAmount, short toAmount, optional TweenTiming, optional TweenStyle);
Tweens the shake screen amount and delay from one value to another. Range: Delay: from -2 to ... Amount: from 1 to 30.
Example:
TweenShakeScreen(3.0, 2, 2, 1, 15);
Will tween the shake screen amount from 1 to 15 with a constant delay of 2.
TweenAreaScaling
// AGS 2.x and 3.x TweenAreaScaling(float seconds, short area, short fromMin, short toMin, short fromMax, short toMax, optional TweenTiming, optional TweenStyle);
Tweens the area scaling for a specific area from one min and max value to another. Range for min and max: 5 - 200.
Example:
TweenAreaScaling(3.0, 1, 50, 100, 100, 200);
Will tween the scaling for area 1 from 50-100 to 100-200.
TweenImage
// AGS 3.x Object.TweenImage(Object* tmpObjectRef, float seconds, short toSprite, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenObjectImage(Object* object, Object* tmpObjectRef, float seconds, short toSprite, optional TweenTiming, optional TweenStyle);
Tweens the image of the object.
Note that this function currently requires the use of a second object for the transformation to take effect. Just create an invisible object in the room and pass it to the function (when AGS will support creating objects from code this won't be necessary).
Example:
// AGS 3.x oBlueCup.TweenImage(oTmpObject, 1.5, 167); // AGS 2.x TweenObjectImage(oBlueCup, oTmpObject, 1.5, 167);
Will tween the image of the BlueCup object from its current sprite to sprite 167.
TweenAnimationSpeed
// AGS 3.x Character.TweenAnimationSpeed(float seconds, short toAnimationSpeed, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenCharacterAnimationSpeed(Character* characterRef, float seconds, short toAnimationSpeed, optional TweenTiming, optional TweenStyle);
Tweens the animation speed of the character.
Example:
// AGS 3.x cEgo.TweenAnimationSpeed(1.5, -100); // AGS 2.x TweenCharacterAnimationSpeed(cEgo, 1.5, -100);
Will tween the animation speed of the character from its current animation speed to -100 (which is really fast).
TweenZOrder
// AGS 3.x GUI.TweenZOrder(GUI* guiRef, float seconds, short toZOrder, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenGUIZOrder(GUI* guiRef, float seconds, short toZOrder, optional TweenTiming, optional TweenStyle);
Tweens the Z Order of the gui.
Example:
// AGS 3.x gStatusLine.TweenZOrder(1.5, 100); // AGS 2.x TweenGUIZOrder(gStatusLine, 1.5, 100);
Will tween the Z order of the statusLine Gui from its current Z order to 100 (which is in the behind 100 other guis).
TweenLightLevel
// AGS 3.x Region.TweenLightLevel(float seconds, short toLightLevel, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenRegionLightLevel(Region* regionRef, float seconds, short toLightLevel, optional TweenTiming, optional TweenStyle);
Tweens the light level for the region. Range: -100 (very dark) to 100 (very bright)
Example:
// AGS 3.x rGarden.TweenLightLevel(1.5, 0); // AGS 2.x TweenRegionLightLevel(rGarden, 1.5, 0);
Will tween the light level of the garden region from its current light level to 0 (which is very dark).
TweenTintR
// AGS 3.x Region.TweenTintR(float seconds, short toR, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenRegionTintR(Region* regionRef, float seconds, short toR, optional TweenTiming, optional TweenStyle);
Tweens the Red portion for the region. Range: 0 to 255.
Note that to diminish the effect of the tint you need to set the LightLevel property for the region.
Example:
// AGS 3.x rGarden.TweenTintR(1.5, 200); // AGS 2.x TweenRegionTintR(rGarden, 1.5, 200);
Will tween the Red portion of the garden region from its current portion to 200 (which is pretty red).
TweenTintG
// AGS 3.x Region.TweenTintG(float seconds, short toG, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenRegionTintG(Region* regionRef, float seconds, short toG, optional TweenTiming, optional TweenStyle);
Tweens the Green portion for the region. Range: 0 to 255.
Note that to diminish the effect of the tint you need to set the LightLevel property for the region.
Example:
// AGS 3.x rGarden.TweenTintG(1.5, 200); // AGS 2.x TweenRegionTintG(rGarden, 1.5, 200);
Will tween the Green portion of the garden region from its current portion to 200 (which is pretty green).
TweenTintB
// AGS 3.x Region.TweenTintB(float seconds, short toB, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenRegionTintB(Region* regionRef, float seconds, short toB, optional TweenTiming, optional TweenStyle);
Tweens the Blue portion for the region. Range: 0 to 255.
Note that to diminish the effect of the tint you need to set the LightLevel property for the region.
Example:
// AGS 3.x rGarden.TweenTintB(1.5, 200); // AGS 2.x TweenRegionTintB(rGarden, 1.5, 200);
Will tween the Blue portion of the garden region from its current portion to 200 (which is pretty blue).
TweenTintAmount
// AGS 3.x Region.TweenTintAmount(float seconds, short toAmount, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenRegionTintAmount(Region* regionRef, float seconds, short toAmount, optional TweenTiming, optional TweenStyle);
Tweens the amount of tint for the region. Range: 0 to 100.
Note that to diminish the effect of the tint you need to set the LightLevel property for the region.
Example:
// AGS 3.x rGarden.TweenTintAmount(1.5, 100); // AGS 2.x TweenRegionTintAmount(rGarden, 1.5, 100);
Will tween the amount of tint of the garden region from its current amount to 100%.
TweenTintBlackAndWhite
// AGS 3.x Region.TweenTintBlackAndWhite(float seconds, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenRegionTintBlackAndWhite(Region* regionRef, float seconds, optional TweenTiming, optional TweenStyle);
Tweens the region to appear black and white.
Note that to diminish the effect of the tint you need to set the LightLevel property for the region.
Example:
// AGS 3.x rGarden.TweenTintBlackAndWhite(1.5); // AGS 2.x TweenRegionTintBlackAndWhite(rGarden, 1.5);
Will tween the garden region look from its current look to black and white.
TweenColorR
// AGS 3.1+ TextBox.TweenColorR(float seconds, short toR, optional TweenTiming, optional TweenStyle); // AGS 3.x Label.TweenColorR(float seconds, short toR, optional TweenTiming, optional TweenStyle); Button.TweenColorR(float seconds, short toR, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenLabelColorR(Label* label, float seconds, short toR, optional TweenTiming, optional TweenStyle); TweenButtonColorR(Button* button, float seconds, short toR, optional TweenTiming, optional TweenStyle);
Tweens the red portion for the label, textbox or button. Range: 0 - 255
Note that to get a better result start with a color that is bigger than 30 (since 0 - 30 are reserved colors).
Example:
// AGS 3.x myLabel.TweenColorR(1.5, 200); // AGS 2.x TweenLabelColorR(myLabel, 1.5, 200);
Will tween the red portion of the color of the label, textbox and button from the current portion to 200 (which is pretty red).
TweenColorG
// AGS 3.1+ TextBox.TweenColorG(float seconds, short toG, optional TweenTiming, optional TweenStyle); // AGS 3.x Label.TweenColorG(float seconds, short toG, optional TweenTiming, optional TweenStyle); Button.TweenColorG(float seconds, short toG, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenLabelColorG(Label* label, float seconds, short toG, optional TweenTiming, optional TweenStyle); TweenButtonColorG(Button* button, float seconds, short toG, optional TweenTiming, optional TweenStyle);
Tweens the green portion for the label, textbox or button. Range: 0 - 255
Note that to get a better result start with a color that is bigger than 30 (since 0 - 30 are reserved colors).
Example:
// AGS 3.x myLabel.TweenColorG(1.5, 200); // AGS 2.x TweenLabelColorG(myLabel, 1.5, 200);
Will tween the green portion of the color of the label, textbox and button from the current portion to 200 (which is pretty green).
TweenColorB
// AGS 3.1+ TextBox.TweenColorB(float seconds, short toB, optional TweenTiming, optional TweenStyle); // AGS 3.x Label.TweenColorB(float seconds, short toB, optional TweenTiming, optional TweenStyle); Button.TweenColorB(float seconds, short toB, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenLabelColorB(Label* label, float seconds, short toB, optional TweenTiming, optional TweenStyle); TweenButtonColorB(Button* button, float seconds, short toB, optional TweenTiming, optional TweenStyle);
Tweens the blue portion for the label, textbox or button. Range: 0 - 255
Note that to get a better result start with a color that is bigger than 30 (since 0 - 30 are reserved colors).
Example:
// AGS 3.x myLabel.TweenColorB(1.5, 200); // AGS 2.x TweenLabelColorB(myLabel, 1.5, 200);
Will tween the blue portion of the color of the label, textbox and button from the current portion to 200 (which is pretty blue).
TweenValue
// AGS 3.x Slider.TweenValue(float seconds, short toValue, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenSliderValue(float seconds, short toValue, optional TweenTiming, optional TweenStyle);
Tweens the value of the slider.
Note that the value should be between the min and max values for the slider.
Example:
// AGS 3.x mySlider.TweenValue(1.5, 200); // AGS 2.x TweenSliderValue(mySlider, 1.5, 200);
Will tween the value of the slider from the current value to 200.
TweenHandleOffset
// AGS 3.1+ Slider.TweenHandleOffset(float seconds, short toOffset, optional TweenTiming, optional TweenStyle); // AGS 3.0 and 2.x NOT SUPPORTED
Tweens the offset of the slider handle.
Example:
// AGS 3.1+ mySlider.TweenHandleOffset(1.5, 20);
Will tween the handle offset of the slider from the current value to 20.
TweenSelectedItem
// AGS 3.x ListBox.TweenSelectedItem(float seconds, short toSelectedItem, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenListBoxSelectedItem(ListBox* listBox, float seconds, short toSelectedItem, optional TweenTiming, optional TweenStyle);
Tweens the selected item for the list box.
Example:
// AGS 3.x myListBox.TweenSelectedItem(1.5, 20); // AGS 2.x TweenListBoxSelectedItem(myListBox, 1.5, 20);
Will tween the selected item of the listbox from the current value to 20.
TweenTopItem
// AGS 3.x ListBox.TweenTopItem(float seconds, short toTopItem, optional TweenTiming, optional TweenStyle); InvWindow.TweenTopItem(float seconds, short toTopItem, optional TweenTiming, optional TweenStyle); // AGS 2.x TweenListBoxTopItem(ListBox* listBox, float seconds, short toTopItem, optional TweenTiming, optional TweenStyle); TweenInvWindowTopItem(ListBox* listBox, float seconds, short toTopItem, optional TweenTiming, optional TweenStyle);
Tweens the top item for the list box or inventory window.
Example:
// AGS 3.x myListBox.TweenTopItem(1.5, 20); myInventory.TweenTopItem(1.5, 20); // AGS 2.x TweenListBoxTopItem(myListBox, 1.5, 20); TweenInvWindowTopItem(myInventory, 1.5, 20);
Will tween the top item of the listbox and inventory window from the current value to 20.
TweenSoundVolume
// AGS 2.x and 3.x TweenSoundVolume(float seconds, short fromVolume, short toVolume, optional TweenTiming, optional TweenStyle);
Tweens the sound effect volume from one value to another. Range: 0 to 255.
Example:
TweenSoundVolume(3.0, 100, 50);
Will tween the sound effect volume from 100 to 50.
TweenMusicMasterVolume
// AGS 2.x and 3.x TweenMusicMasterVolume(float seconds, short fromVolume, short toVolume, optional TweenTiming, optional TweenStyle);
Tweens the master music volume from one value to another. Range: 1 to 100.
Example:
TweenMusicMasterVolume(3.0, 100, 50);
Will tween the music volume from 100 to 50.
TweenDigitalMasterVolume
// AGS 2.x and 3.x (without new-style audio scripting enforced) TweenDigitalMasterVolume(float seconds, short fromVolume, short toVolume, optional TweenTiming, optional TweenStyle);
Tweens the master digital volume from one value to another. Range: 1 to 100.
Example:
TweenDigitalMasterVolume(3.0, 100, 50);
Will tween the digital volume from 100 to 50.
TweenChannelVolume
// AGS 2.x and 3.x (without new-style audio scripting enforced) TweenChannelVolume(float seconds, short channel, short fromVolume, short toVolume, optional TweenTiming, optional TweenStyle);
Tweens the volume for a given channel from one value to another. Range: 0 to 255.
Example:
TweenChannelVolume(3.0, 1, 100, 50);
Will tween the volume for channel 1 from 100 to 50.
TweenSpeechVolume
// AGS 2.x and 3.x TweenSpeechVolume(float seconds, short fromVolume, short toVolume, optional TweenTiming, optional TweenStyle);
Tweens the volume for speech from one value to another. Range: 0 to 255.
Example:
TweenSpeechVolume(3.0, 100, 50);
Will tween the volume for speech from 100 to 50.
TweenSystemVolume (new)
// AGS 3.2 (with new-style audio scripting enforced) TweenSystemVolume(float seconds, short toVolume, optional TweenTiming, optional TweenStyle);
Tweens the master volume (System.Volume) to a new value. Range: 0 to 100.
Example:
System.Volume = 100; TweenSystemVolume(3.0, 50);
Will tween the system volume from 100 to 50.
AudioChannel.TweenPanning (new)
// AGS 3.2 (with new-style audio scripting enforced) AudioChannel.TweenPanning(float seconds, short toPanning, optional TweenTiming, optional TweenStyle);
Tweens an AudioChannel panning to to a new value. Range: -100 to 100.
Example:
myAudioChannel.Panning = -100; myAudioChannel.TweenPanning(3.0, 100);
Will tween the AudioChannel panning from -100 to 100 in 3 seconds.
AudioChannel.TweenVolume (new)
// AGS 3.2 (with new-style audio scripting enforced) AudioChannel.TweenVolume(float seconds, short toVolume, optional TweenTiming, optional TweenStyle);
Tweens an AudioChannel volume to to a new value. Range: 0 to 100.
Example:
myAudioChannel.Volume = 0; myAudioChannel.TweenPanning(3.0, 100);
Will tween the AudioChannel volume from 0 to 100 in 3 seconds.
AudioChannel.TweenRoomLocation (new)
// AGS 3.2 (with new-style audio scripting enforced) AudioChannel.TweenRoomLocation(float seconds, short toX, short toY, optional TweenTiming, optional TweenStyle);
Tweens an AudioChannel room location to a new x and y value. Note that Tweening to 0, 0 will remove the directional effect immediately, possibly creatin a strange effect.
Example:
myAudioChannel.SetRoomLocation(1, 1); myAudioChannel.TweenRoomLocation(3.0, 320, 240);
Will tween the AudioChannel room location to 320, 240.